package com.lightbend.akka

import akka.actor.{ActorRef, ActorSystem, DeadLetter, Props}

object AkkaMailboxApp extends App {

  private implicit val system:ActorSystem = ActorSystem("akka-mailbox")

  val boundedActor: ActorRef = system.actorOf(Props.create(classOf[MyBoundedActor]))

  val deadActor: ActorRef = system.actorOf(Props(classOf[DeadLetterMetricsActor]))

  system.eventStream.subscribe(deadActor, classOf[DeadLetter])

  val s = System.currentTimeMillis()
  for (i <- 1 to 3000) boundedActor ! i

  println(s"==========================> ${System.currentTimeMillis() - s}")
//  system.eventStream.unsubscribe(deadActor)


}
